﻿@page "/app/settings/minimal"
@inject SettingsVM SettingsVM
@inject IJSRuntime JSRuntime;
@implements IDisposable
<div>
    <MudGrid Class="pa-0 ma-0" Spacing="0" Style="height: 100%;">
        <MudItem xs="12">
            <div class="d-flex align-center justify-center mx-2 mb-1">
                <MudText Typo="Typo.subtitle1" Color="Color.Inherit">Minimal UI Settings</MudText>
            </div>
        </MudItem>
        <MudItem xs="12">
            <MudPaper Class="align-center justify-center pa-2 mx-2 mb-2" Elevation="2">
                <MudStack Spacing="0">
                    <MudCheckBox @bind-Checked="SettingsVM.ShowName" Label="Name" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowAvgDayPrice" Label="Avg. Daily Price" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowPricePerSlot" Label="Price per Slot" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowTraderPrice" Label="Trader Price" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowKappa" Label="Kappa Needed" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowQuestHideoutTracker" Label="Needed Quest & Hideout" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowQuestHideoutTeamTracker" Label="Needed Quest & Hideout Team" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudCheckBox @bind-Checked="SettingsVM.ShowUpdated" Label="Updated Timestamp" Dense="true" Size="Size.Small" Class="pa-0 ma-0"></MudCheckBox>
                    <MudSlider Step="10" @bind-Value="SettingsVM.Opacity" Min="0" Max="100" Dense="true" Color="Color.Primary">
                        <MudText Typo="Typo.subtitle2" Class="mt-0">Opacity: @SettingsVM.Opacity.ToString()</MudText>
                    </MudSlider>
                </MudStack>
            </MudPaper>
        </MudItem>
    </MudGrid>
</div>

@code {

    protected override void OnInitialized()
    {
        SettingsVM.PropertyChanged += PropertyChangeHandler;
    }

    private async void PropertyChangeHandler(object? sender, EventArgs e)
    {
        await InvokeAsync(() => StateHasChanged());
    }

    public void Dispose()
    {
        SettingsVM.PropertyChanged -= PropertyChangeHandler;
    }

}
